#ifndef _ACCOUNT_MGR_H
#define _ACCOUNT_MGR_H

struct Account
{
	ui32 id;
	char* username;
	ui8* passwordhash;
	ui8 sessionkey[40];
	char* gmstring;
	string country;
};


class DLL_EXPORT AccountManager : public Single<AccountManager>
{
	Mutex m_lock;
	std::map<const char*, Account*> m_accounts;
public:
	AccountManager()
	{
		LoadAccounts();
	}

	void LoadAccounts();

	Account* GetAccount(const char* name);
	void AddAccount(const char* username, const char* passwd);
};

class AccountWorker : public CThread
{
	ui32 refresh;
public:
	AccountWorker() : refresh(120)
	{
	}

	void Loop();
};

#define AccountMgr AccountManager::getSingle()

#endif